package com.example.dense_rack_server.mapper;

import com.example.dense_rack_server.entity.ArchivesArea;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.dense_rack_server.entityVo.MenuALLVo;
import com.example.dense_rack_server.entityVo.MyAreaTreeVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 档案区域 Mapper 接口
 * </p>
 *
 * @author 张彬
 * @since 2025-03-04
 */
public interface ArchivesAreaMapper extends BaseMapper<ArchivesArea> {

    /**
     * 绘制区域树
     */
    @Select("select d.id as id,d.parent_id as parentId ,d.area_name as title from archives_area as d " +
            "where d.delete_status = 0 order by d.sort")
    List<MyAreaTreeVo> buildAres();


    /**
     * 绘制区域树(新增使用)
     */
    @Select("select d.id as id,d.parent_id,d.area_name as title from archives_area as d where d.status = 1 " +
            "and d.delete_status = 0 order by d.sort")
    List<MenuALLVo> buildAreaTree();

    /**
     * 查询所有下级区域包含本身
     */
    List<Integer> queryAllSubordinates(Integer areaId);

    /**
     * 查询所有下级区域包含本身
     */
    List<ArchivesArea> bottomAreaId(Integer areaId);



}
